<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>g_margin</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : April 1993</div>
    <p>
      <b>g_margin</b> -  gain margin</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>[gm [,fr]]=g_margin(h)   </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>h</b>
        </tt>: <tt>
          <b>syslin</b>
        </tt> list representing a linear system in  state-space or transfer form</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
    returns <tt>
        <b>gm</b>
      </tt>, the gain margin in dB of <tt>
        <b>h</b>
      </tt> 
    (SISO plant) and <tt>
        <b>fr</b>
      </tt>, the achieved corresponding frequency in hz.
    The gain margin is values of the system gain at points where the
    nyquist plot crosses the negative real axis.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

h=syslin('c',-1+%s,3+2*%s+%s^2)
[g,fr]=g_margin(h)
[g,fr]=g_margin(h-10)
nyquist(h-10)
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="p_margin.htm">
        <tt>
          <b>p_margin</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../graphics/black.htm">
        <tt>
          <b>black</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../graphics/chart.htm">
        <tt>
          <b>chart</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../graphics/nyquist.htm">
        <tt>
          <b>nyquist</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
